#include "IntroState.h"
#include "Game.h"
#include "MainMenuState.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"

IntroState* IntroState::pInstance = nullptr;

IntroState::IntroState(void)
{
	this->TeamLogoID = CSGD_TextureManager::GetInstance()->LoadTexture((_T("Textures\\STLogo.png")));
	StateTimer = 2.0f;
}


IntroState::~IntroState(void)
{
}

IntroState* IntroState::GetInstance( void )
{
	// Allocate the static pointer if necessary
	if( pInstance == nullptr )
		pInstance = new IntroState();

	// Return the singleton
	return pInstance;
}

void IntroState::DeleteInstance( void )
{
	delete pInstance;
	pInstance = nullptr;
}

//////////////////////////////////////////////////
// GameState Methods:
void IntroState::Update(float deltaTime)
{
	StateTimer -= deltaTime;

	if( StateTimer <= 0.0f )
		Game::GetInstance()->ChangeState(MainMenuState::GetInstance());
}
void IntroState::Render(void) const		
{
	RECT BackgroundRect = {0,0, Game::GetInstance()->GetScreenWidth(), Game::GetInstance()->GetScreenHeight()};

	D3D->DrawRect(BackgroundRect, D3DCOLOR_ARGB(255,0,0,0));
	//D3D->DrawRect(BackgroundRect, D3DCOLOR_ARGB(255,255,255,255));


	CSGD_TextureManager::GetInstance()->Draw(TeamLogoID,Game::GetInstance()->GetScreenWidth() / 2 - 512,Game::GetInstance()->GetScreenHeight() / 2 - 512);
}
void IntroState::Enter(void)	
{
	GameState::Enter();
}
void IntroState::Exit(void)		
{
	GameState::Exit();
	DeleteInstance();
}